import { saveRemark } from '@/api/order'
import { ref } from 'vue'

const useServiceProcessForm = () => {
  const form = ref({
    annexs: [],
    remark: '',
    visitTypes: [0],
  })

  const submitLoading = ref(false)

  const submit = async (orderIds: Array<string>) => {
    submitLoading.value = true
    const res = await saveRemark({ ...form.value, workIds: orderIds })
    submitLoading.value = false
    return res.data as { data: object; code: number; message: string; success: boolean }
  }

  return {
    form,
    submitLoading,
    submit,
  }
}

export default useServiceProcessForm
